package com.zoo.diannaopeijian.service.impl;

import com.zoo.diannaopeijian.comm.page.Page;
import com.zoo.diannaopeijian.comm.sql.GeneratorExampleBuilder;
import com.zoo.diannaopeijian.domain.ComponentParameter;
import com.zoo.diannaopeijian.domain.ComponentParameterExample;
import com.zoo.diannaopeijian.mapper.ComponentParameterMapper;
import org.springframework.stereotype.Service;
import com.zoo.diannaopeijian.service.ComponentParameterService;
import javax.annotation.Resource;
import java.util.List;

/**
 * Created by zx583 on 2018-01-15.
 */
@Service
public class ComponentParameterServiceImpl implements ComponentParameterService {
    @Resource
    private ComponentParameterMapper componentParameterMapper;

    @Override
    public boolean addComponentParameter(ComponentParameter componentparameter) {
        return componentParameterMapper.insertSelective(componentparameter) == 1;
    }

    @Override
    public boolean updateComponentParameter(ComponentParameter componentparameter) {
        return componentParameterMapper.updateByPrimaryKeySelective(componentparameter) == 1;
    }

    @Override
    public boolean deleteComponentParameter(Integer componentparameterid) {
        return componentParameterMapper.deleteByPrimaryKey(componentparameterid) == 1;
    }

    @Override
    public List<ComponentParameter> getComponentParameter(ComponentParameter componentparameter) {
        ComponentParameterExample example = (ComponentParameterExample) GeneratorExampleBuilder.buildEqualExample(ComponentParameterExample.class, componentparameter, true);

        return componentParameterMapper.selectByExample(example);
    }

    @Override
    public List<ComponentParameter> getComponentParameterWithPage(ComponentParameter componentparameter, Page page) {
        page.onPage();

        return getComponentParameter(componentparameter);
    }
}
